'use strict';

const Controller = require('egg').Controller;

class HomeController extends Controller {
    // async index () {
    //     const { ctx } = this;
    //     const { id } = ctx.query;
    //     ctx.body = 'hi, egg' + '---' + id;
    // }
    // async user () {
    //     const { ctx } = this;
    //     const { id } = ctx.params;
    //     ctx.body = 'hi, egg' + '====' + id;
    // }
    async add () {
        const { ctx } = this;

        const { name, slogan } = await ctx.request.body;
        ctx.body = 'hi, egg' + '==name==' + name + '---slogan=' + slogan;
    }
    async user () {
        const { ctx } = this
        const { id } = await ctx.query
        console.log('------------ = id');
        ctx.body = {
            id:'aaaaa==='+id
        }
    }

    // 测试ejs
    async index () {
        const { ctx } = this
        await ctx.render('index.html', {
            title: "测试ejs"
        })
    }

    //
    async indexTaskList(){
        const { ctx } = this
        const result = require('../../test/mode/index')
        ctx.body = result.indexList
    }
}

module.exports = HomeController;
